Skip to content

fix(compiler): strip abstract keyword from class expressions in JIT mode#157

Merged
Brooooooklyn merged 2 commits intovoidzero-dev:mainfrom
ashley-hunter:fix/abstract-class
Mar 24, 2026
Merged

fix(compiler): strip abstract keyword from class expressions in JIT mode#157
Brooooooklyn merged 2 commits intovoidzero-dev:mainfrom
ashley-hunter:fix/abstract-class

Conversation

@ashley-hunter
Copy link
Contributor

Closes #148

Summary

  • Fixes JIT compilation of abstract classes by stripping the abstract keyword when converting class declarations to class expressions (let X = class X)
  • Class expressions in JavaScript/TypeScript cannot use the abstract modifier, so it must be removed during the JIT transform

Test plan

  • Added integration test test_jit_abstract_class covering exported abstract class with @Injectable()
  • Verifies abstract class does not appear in output
  • Verifies correct class expression form (let X = class X)
  • Verifies __decorate call is present
  • Snapshot test for full output validation

@Brooooooklyn
Copy link
Member

Should we use oxc-transform in JIT mode?

ashley-hunter and others added 2 commits March 23, 2026 20:55
…nsformer

Add a `strip_typescript()` post-pass after JIT text-edits that uses
oxc_transformer + oxc_codegen to convert TypeScript → JavaScript. This
handles abstract members, type annotations, parameter properties, and
other TS-only syntax that previously leaked into JIT output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ashley-hunter
Copy link
Contributor Author

Thanks for the suggestion! And great work on the project - it's amazing! I have added in oxc-transform for JIT transpilation. I did have to retain the abstract stripping change because of how we convert the class to a class expression which would result in invalid TS if it abstract keyword was retained - but any feedback or suggestions let me know! Thanks!

@Brooooooklyn Brooooooklyn merged commit 57dfd59 into voidzero-dev:main Mar 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

abstract class keyword not stripped from compiled output

2 participants